package net.neptech.model.appointment;

import jakarta.persistence.*;

import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.Comment;
import java.util.Date;

/**
 * 预约记录表
 */
@Data
@Comment("预约记录表")
@Accessors(chain = true)
@Entity
@Table(name = "appointment")
public class Appointment  {
    @Id
    @Comment("主键")
    @Column(name = "id", nullable = false) //雪花id自己生成
    private Long id;


    @Comment("渠道：1预约线下/2预约线上排班")
    @Column(name = "channel", nullable = false)
    private Byte channel;

    @Comment("坐诊id绑定")
    @Column(name = "clnic_id")
    private Long clnicId;
    @Comment("就诊人ID → patient.id")
    @Column(name = "patient_id", nullable = false)
    private Long patientId;
    @Comment("患者姓名")
    @Column(name = "patient_name")
    private String patientName;

    @Comment("上午 下午")
    @Column(name = "period")
    private String period;
    @Comment("医生/医护人员ID")
    @Column(name = "staff_id")
    private Long staffId;

    @Comment("对应的排班时段编号")
    @Column(name = "slot_no")
    private Integer slotNo;


    @Comment("0待支付/1已支付/2已取消/3爽约/4已完成")
    @ColumnDefault("0")
    @Column(name = "status", nullable = false)
    private Byte status;

    @Comment("订单ID → order_master.id（待支付可空）")
    @Column(name = "order_id")
    private Long orderId;


    @Comment("预约时间")
    @Column(name = "booked_at", nullable = false)
    private Date bookedAt;


    @Comment("取消原因（可空）")
    @Column(name = "cancel_reason")
    private String cancelReason;


    @Comment("创建时间")
    @ColumnDefault("CURRENT_TIMESTAMP")
    @Column(name = "created_at", nullable = false, updatable = false, insertable = false)
    private Date createdAt;


    @Comment("更新时间")
    @ColumnDefault("CURRENT_TIMESTAMP")
    @Column(name = "updated_at", nullable = false, insertable = false)
    private Date updatedAt;

    @Comment("user_id")
    @Column(name = "user_id")
    private Long userId;

}